import 'package:flutter/material.dart';

class ResultView extends StatelessWidget {
  const ResultView(
      {Key? key,
      required this.text,
      required this.controller,
      required this.viewKey})
      : super(key: key);
  final String text;
  final ScrollController controller;
  final Key viewKey;

  @override
  Widget build(BuildContext context) {
    final viewWidth = MediaQuery.of(context).size.width;
    TextTheme textTheme = Theme.of(context).textTheme;
    return Expanded(
        child: SingleChildScrollView(
            controller: controller,
            child: SizedBox(
                key: viewKey,
                width: viewWidth,
                child:

                Container(
                  constraints: const BoxConstraints(
                    minHeight: 40,
                  ),
                  padding: const EdgeInsets.only(
                    left: 12,
                    right: 12,
                    top: 7,
                    bottom: 7,
                  ),
                  alignment: Alignment.centerLeft,
                  child: SelectableText.rich(
                      TextSpan(
                        text: text
                      ),
                      style: textTheme.bodyMedium!.copyWith(
                        height: 1.4,
                      )),
                )
            )));
  }
}
